package com.ygqh.baby.shiro.credentials;

import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;

public class CustomCredentialsMatcher extends HashedCredentialsMatcher {
	@Override
	public boolean doCredentialsMatch(AuthenticationToken authcToken, AuthenticationInfo info) {
		// UsernamePasswordToken token = (UsernamePasswordToken) authcToken;

		UsernamePasswordToken token = (UsernamePasswordToken) authcToken;
		Object accountCredentials = getCredentials(info);
		String pwd1 = accountCredentials.toString();
		String pwd = String.valueOf(token.getPassword());
		if (pwd1.equals(pwd)) {
			return true;
		}
		return super.doCredentialsMatch(authcToken, info);
	}
	

}
